home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: NLILLY@IXNETCOM.COM
- Newsgroups: comp.lang.c++
- Subject: Visual C++ & API Calls to SQL Database ?
- Date: Sat, 03 Feb 1996 03:48:57 GMT
- Organization: Netcom
- Message-ID: <4eum1q$9v7@ixnews5.ix.netcom.com>
- NNTP-Posting-Host: ix-min6-06.ix.netcom.com
- X-NETCOM-Date: Fri Feb 02 7:50:18 PM PST 1996
- X-Newsreader: Forte Free Agent 1.0.82
-
- I am a Mainframe programmer who is in the process of learning Visual
- C++. I have written a few simple C programs which take their
- information from a download file and input it into a Gupta SQLBASE 6.0
- database via Gupta's C API routines. However, when I try to compile
- the program into a C++ program I receive the following error:
-
- error C2664: 'sqlcnc' : cannot convert parameter 2 from 'char
- (__near *) [22] ' to 'unsigned char __far *'
-
- The program is as follows:
-
- #include <stdio.h>\
-
- #include "sql.h"
-
- SQLTAPI sqlcmt(cur);
- SQLTCUR cur;
- SQLTRCD rcd;
- char errmsg[SQLMERR];
-
- main()
- {
- if (rcd = sqlcnc(&cur, "amgdbms/sysadm/sysadm", 0))
- {
- ...
- ...
- }
- ...
- ...
- }
-
- The abrieviated sql.h header file, with the extern "C" statements
- which I added, is as follows:
-
- #ifndef SQL_16BITTARG
- #if !SQL_32BITTARG
- #define SQL_16BITTARG 1
- #else
- #define SQL_16BITTARG 0
- #endif
- #endif
- ...
- ...
- typedef ubyte2 SQLTCUR;
- typedef ubyte2 SQLTDAL;
- typedef ubyte1p SQLTDAP;
- ...
- ...
- #if SQL_16BITTARG
- #define SQLTAPI byte2 far pascal
- #elif SQL_OS2
- #ifdef__IBMC__
- #define SQLTAPI byte2 __System
- #else
- #define SQLTAPI byte2 __syscall
- #endif
- #else
- #define SQLTAPI byte2 __stdcall
- #endif
- ...
- ...
- #ifndef NLINT_ARGS
- ...
- ...
- extern "C" {
- SQLTAPI sqlcnc(SQLTCUR PTR curp ,SQLTDAP dbnamp,
- SQLTDAL dbnaml);
- ...
- ...
- }
- #else
- extern "C"{
- SQLTAPI sqlcnc();
- ...
- ...
- }
-
- I am told that Gupta does not offer any C++ API routines, and
- therefore I am stuck with getting the C routines to work. I would be
- very grateful for any suggestions that anyone may have.
-
- Thanks...
-
-
-
-